#include <QApplication>
#include <QQuickImageProvider>
#include <QClipboard>
#include <QScreen>
#include <QDebug>

class PixmapProvider : public QQuickImageProvider {
public:
    PixmapProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) {}

    QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override
    {
        if (id.startsWith("shot"))
        {
            auto clipboard = QApplication::clipboard();
            return clipboard->pixmap();
        }
        auto screen = QApplication::primaryScreen();
        return screen->grabWindow(0);
    }
};
